import request from '@/utils/request';

export function fetch({ pageNo, pageSize }) {
  return request('/tlss/command/UserManage',
    { method: 'userData2', pageNo, pageSize},
    'POST'
  );
}

export function getAllRoles() {
  return request('/tlss/command/UserManage',
    { method: 'allRoles2'}
  );
}

//{ username, password, phone, email, role }
export function add(user) {
  return request('/tlss/command/UserManage',
    { method: 'addUser2', ...user},
    'POST'
  );
}

//{ username, password, phone, email, role }
export function edit(username, rest) {
  return request('/tlss/command/UserManage',
    { method: 'editUser2', username, ...rest},
    'POST'
  );
}

export function remove(username) {
  return request('/tlss/command/UserManage',
    { method: 'delUser2', username}
  );
}
